module.exports = {
	computed: {
		vuex_token() {
			let token = uni.getStorageSync('token');
			return token
		},
		vuex_config() {
			let lifeData = uni.getStorageSync('lifeData');
			return lifeData.vuex_config
		},
		vuex_theme() {
			let lifeData = uni.getStorageSync('lifeData');
			return lifeData.vuex_theme
		},
		vuex_user() {
			let lifeData = uni.getStorageSync('lifeData');
			return lifeData.vuex_user ? lifeData.vuex_user : {money:0}
		},
		vuex_signin() {
			let lifeData = uni.getStorageSync('lifeData');
			return lifeData.vuex_signin
		},
		vuex_othen_user() {
			let lifeData = uni.getStorageSync('lifeData');
			return lifeData.vuex_othen_user
		},
		vuex__token__() {
			let token = uni.getStorageSync('vuex__token__');
			return this.$store.state.community.vuex__token__
		},
		theme() {
			var lifeData = uni.getStorageSync('lifeData') || {}
			if (lifeData.vuex_theme?.value) {				
				let theme = lifeData.vuex_theme.value;
				let colorArr = this.$u.colorGradient(theme.bgColor, theme.color, theme.ladder);								
				return Object.assign({
					lightColor:colorArr[theme.number] || '#f5f5f5',
					faBorderColor:colorArr[theme.border] || '#f5f5f5'
				},theme);
			}
			return {
				bgColor: "#0301c5",
				border: 5,
				color: "#ffffff",
				ladder: 10,
				number: 9,
				lightColor:'#f5f5f5',
				faBorderColor:'#f5f5f5'
			};
		},	
		btnBgColor(vote, type) {
			return (vote, type) => {
				if(typeof type == 'undefined'){
					return vote ? this.theme.bgColor : this.theme.lightColor;
				}
				return vote == type ? this.theme.bgColor : this.theme.lightColor;
			};
		},
		btnColor(vote, type) {
			return (vote, type) => {
				if(typeof type == 'undefined'){
					return vote? this.theme.color : this.theme.bgColor;
				}
				return vote == type ? this.theme.color : this.theme.bgColor;
			};
		}
	},
}
